package com.zh.modules.app.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * SnowflakeInitiator
 *
 * @author zhuhao
 * <p>
 * 2022-01-14 14:04
 */
@Component
@Slf4j
public class SnowflakeInitiator {

    /**
     * 尝试初始化
     *
     * @return
     */
    @PostConstruct
    public void init() {
        SnowFlake.initialize(0, 8);
    }

    public static void main(String[] args) {
        SnowFlake.initialize(0, 8);

        System.out.println(SnowFlake.getId());
    }
}